package com.hmall.common.client;

import com.hmall.common.dto.PageDTO;


import com.hmall.common.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient("itemservice")
public interface FeignItemClient {
    @GetMapping("/item/list")
    PageDTO<Item> getPageItem(@RequestParam("page") Integer page, @RequestParam("size")Integer size);

    @GetMapping("/item/{id}")
    Item selectItemById(@PathVariable("id") Long id);

    @PutMapping("/item/stock/{itemId}/{num}")
    public void reduceGoodsFrequency(@PathVariable("itemId") Long itemId,
                                     @PathVariable("num") Integer num);

    @GetMapping("/item/users/{id}/{bs}")
    void updateUser(@PathVariable("id") Long id, @PathVariable("bs") Long bs);

    //根据id修改商品

    @PutMapping("/item/update/{id}/{stock}")
    void updateItem(@PathVariable("id") Long id, @PathVariable("stock") Integer stock);

    /**
     * 将订单状态为5的库存加回来
     * @param id 订单id
     * @param num 数量
     */
    @RequestMapping("/item/{itemId}/{num}")
    void updateStock(@PathVariable("itemId") Long id,@PathVariable("num") Integer num);
}

